<div style="max-height:500px;overflow-y:auto;">
    <div style="color: #60be29;">
        <%=package.appname_en%>（<%=package.appname_cn%>）
        <!--<a target="_blank" href="/upgradePackage/downloadZipFile?id=<%=package.id%>">下载</a> |
        <a href="javascript:void(0)" id="removePackage">删除</a>-->
    </div>
    <table class="am-table am-table-bordered am-table-hover dataTable work-table style="font-size:12px;margin-bottom:0">
        <tbody>
            <%packageFiles.forEach(function(item) {%>
                <tr>
                    <td style="width:88%">
                        <%=item.file_path%>
                    </td>
                    <td>
                        <a target="_blank" href="/upgradePackage/downloadFile?id=<%=item.id%>">下载</a>
                        <%if(item.canPreview){%>| <a target="_blank" href="/upgradePackage/previewFile?id=<%=item.id%>">预览</a><%}%>
                    </td>
                </tr>
            <%})%>
        </tbody>
    </table>
</div>

<script>
    $(function() {
        $('#removePackage').click(function() {
            $.confirm({
                title: 'Confirm!',
                content: '确认删除上传的升级包吗？',
                confirm: function() {
                    $.ajax({
                        url: '/upgradePackage/removeZipFile', dataType: "json", cache: false, type: "post", data: 'id=<%=package.id%>',
                        success: function(data) {
                            if (data.success) {
                                $.toast({ text: '删除成功！', showHideTransition: 'slide', icon: 'success', position: 'top-center' });
                            } else {
                                $.toast({ text: '删除失败！', showHideTransition: 'slide', icon: 'error', position: 'top-center' });
                            }
                            window.jc.close();
                        }
                    });
                }
            });
        });
    });
</script>
